<template>
	<layout :loading="loading" curPage="calibration" title="CEMS零点/量程漂移与校准记录">
		
		
		<conditions :list="conditonList" :conditions="conditions" @submit="submitSearch"></conditions>

		<div class="layui-form layui-border-box layui-table-view">

			<tableList :list="page.list" :canSelect="false">

				<block slot="head">
					<th>记录时间</th>
					<th>分析仪原理</th>
					<th>分析仪量程</th>
					<th>计量单位</th>
					<th>零点</th>
					<th>零点上次校准值</th>
					<th>零点校前值</th>
					<th>零点校后值</th>
					<th>零点漂移</th>
					<th>零点校准状态</th>
					<th>标气浓度</th>
					<th>量程上次校准值</th>
					<th>量程校前值</th>
					<th>量程校后值</th>
					<th>量程漂移</th>
					<th>量程仪器校准状态</th>
					<th>点位名称</th>
					<th>企业名称</th>
					<th>运维公司</th>
					<th class="autoWidth">记录人</th>
				</block>

				<block slot="body">

					<tr v-for="( x , index) in page.list" :key="index">
						<td>
							{{x.createTime}}
						</td>
						<td>
							{{x.principle}}
						</td>
						<td>
							{{x.range}}
						</td>
						<td>
							{{x.unit}}
						</td>
						<td>
							{{x.zero}}
						</td>
						<td>
							{{x.lastNum}}
						</td>
						<td>
							{{x.beforeNum}}
						</td>
						<td>
							{{x.afterNum}}
						</td>
						<td>
							{{x.driven}}
						</td>
						<td>
							<switchBtn :url="'/admin/calibration/switchIsNormal?id='+x.id" name="isNormal" :value="x.isNormal" @change="switchPage()" onText="ON" offText="OFF"></switchBtn>
						</td>
						<td>
							{{x.gas}}
						</td>
						<td>
							{{x.rangLastNum}}
						</td>
						<td>
							{{x.rangebeforeNum}}
						</td>
						<td>
							{{x.rangeAfterNum}}
						</td>
						<td>
							{{x.rangeNum}}
						</td>
						<td>
							<switchBtn :url="'/admin/calibration/switchRangeIsNormal?id='+x.id" name="rangeIsNormal" :value="x.rangeIsNormal" @change="switchPage()" onText="正常" offText="异常"></switchBtn>
						</td>
						<td>
							{{x.name}}
						</td>
						<td>
							{{x.companyName1}}
						</td>
						<td>
							{{x.servicerName}}
						</td>
						<td>
							{{x.recorder}}
						</td>
					</tr>

				</block>

			</tableList>
			
			<emptyTips :loading="loading" :list="page.list"></emptyTips>

			<paginate :page="page" @switchPage="switchPage" @changePageSize="changePageSize"></paginate>
			
		</div>


	</layout>
</template>

<script>
	export default {
		data() {
			return {
				conditonList:[
					{title:"创建时间",name:"tc.createTime.start",endName:"tc.createTime.end",type:"date"},
					{title:"运维公司",name:"tsr.name",type:"varchar"},
					{title:"企业名称",name:"tcy.name",type:"varchar"}
				],
				conditions: {},
				loading: true ,
				action: "/admin/calibration/list",
				page: {
					pageNumber: 1,
					lastPage: true,
					totalPage: 1,
					list: [],
					totalRow: 0,
					pageSize: 10
				}
			}
		},
		
		onLoad:function(res){
			this.conditions = res || {} ;
		},

		onShow() {
			this.kit.getPage(this.action,function(res){
			});
		},

		methods: {
			submitSearch:function(conditions){
				this.conditions = conditions ;
				this.switchPage(1);
			},
			
			switchPage: function(pageNumber) {
				this.page.pageNumber = pageNumber || this.page.pageNumber ;
				this.kit.getPage(this.action);
			},
			
			changePageSize: function(pageSize) {
				this.page.pageSize = pageSize;
				this.page.pageNumber = 1;
				this.kit.getPage(this.action);
			},
		}
	}
</script>